#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016-2018, Niklas Hauser
# Copyright (c) 2017, Fabian Greif
#
# This file is part of the modm project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.


def init(module):
    module.name = ":test"
    module.description = "Tests for modm"


def prepare(module, options):
    module.depends(":unittest")
    return True

def build(env):
    env.collect("modm:build:path.include", "modm-test/src")
    core = env[":target"].get_driver("core")["type"]
    core = next((t for t in ("avr", "cortex-m") if core.startswith(t)), "hosted")
    env.outbasepath = "."
    env.copy("runner/{}.cpp".format(core), "main.cpp")
